<!-- 提现二次确认 -->
<template>
	<Modal 
    class="pop-confirm" 
    class-name="vertical-center-modal" 
    width="480" 
    v-model="showPop"
    :title="$t('user.confirmedWithdrawal')">
    <div class="pop-label">
      {{ $t('user.confirmWithdrawal') }}<span class="withdraw-amount"> CNY {{ form.amount || '' }}
      </span>?
    </div>
    <div slot="footer">
      <Button @click="close">{{ $t('user.cancel') }}</Button>
      <Button @click="onSubmit" :loading="loading" type="primary">
        {{ $t('user.confirm') }}
      </Button>
    </div>
  </Modal>
</template>

<script>
  import { withdrawApply } from "@/api/withdraw"; 

	export default{
		data(){
			return{
				showPop:false,
        loading:false,
        form: {},
			}
		},
		methods:{
			open(obj){
        this.form = obj;
        this.showPop = true;
      },
      close(){
        this.showPop = false;
      },
      //提现
      onSubmit() {
        this.loading = true;
        withdrawApply(this.form).then(() => {
          this.loading = false;
          this.form = {};
          this.showPop = false;
          this.$Message.success(this.$t('user.applicationSuccessful'));
          this.$store.dispatch('getUserInfo');
          this.$emit('submitSuccess');
        }).catch(() => {
          this.loading = false;
        })
      },
		}
	}
</script>

<style lang="less" scoped>
	.pop-confirm {
    .withdraw-amount {
      color: @primary-color;
      font-size: 18px;
      font-weight: 500;
    }
    &:deep(.ivu-modal) {
      .pop-footer {
        .btn {
          margin: 0;
          margin-top: 12px;

          &:first-child {
            margin-top: 0;
          }

          .iconfont {
            color: red;
          }
        }
      }
      .ivu-modal-footer {
        border: 0;
      }
    }
  }
</style>